package com.financing.wap.dao.impl;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.wap.common.SqlName;
import com.financing.wap.dao.IActivitieGiftDao;
import com.financing.wap.dto.ActivitieGiftDTO;
import com.financing.wap.dto.ActivitiesWeChatGiftDTO;
import com.financing.wap.vo.ActivitieGiftVo;



@Repository("activitieGiftDaoImpl")
public class ActivitieGiftDaoImpl extends BaseDaoImpl<ActivitieGiftDTO, java.lang.Integer> implements IActivitieGiftDao {

	@Override
	public Class<ActivitieGiftDTO> getEntityClass() {
		return ActivitieGiftDTO.class;
	}

	@SuppressWarnings("deprecation")
	@Override
	public List<ActivitieGiftVo> queryActivitieGiftList(
			Map<String,Object> map) {
		return this.sqlMapClientTemplate.queryForList(SqlName.ACTIVITIE_GIFT_QUERY,map);
	}
	@SuppressWarnings("deprecation")
	@Override
	public List<ActivitieGiftDTO> queryActivitieGiftListForJob(
			Map<String,Object> map) throws Exception{
		return this.sqlMapClientTemplate.queryForList(SqlName.ACTIVITIE_GIFT_QUERY_FORJOB,map);
	}

	@SuppressWarnings("deprecation")
	@Override
	public int updateActivitieGift(ActivitieGiftDTO activitieGiftDTO)
			throws SQLException {
		return this.sqlMapClientTemplate.update(SqlName.ACTIVITIE_GIFT_UPDATE,activitieGiftDTO);
	}

	@Override
	public int insertActivitieGift(ActivitieGiftDTO activitieGiftDTO)
			throws SQLException {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.ACTIVITIE_GIFT_ADD, activitieGiftDTO);
	}

	@Override
	public Integer countActivitiesGift(String faId) {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.COUNT_ACTIVITIES_GIFT,faId);
	}

	@Override
	public BigDecimal mollionsWealthCount() throws Exception {
		return (BigDecimal) this.sqlMapClientTemplate.queryForObject(SqlName.ACTIVITIE_GIFT_MOLLIONS_WEALTH_COUNT);
	}

	@Override
	public List<ActivitieGiftDTO> queryActivitiesHBGift(ActivitieGiftDTO actgift) throws Exception {
		return this.sqlMapClientTemplate.queryForList(SqlName.ACTIVITIE_HB_GIFT_QUERY,actgift);
	}

	@Override
	public List<Map<String, Object>> queryYLYXHDGifts(ActivitieGiftDTO actgift)
			throws Exception {
		return this.sqlMapClientTemplate.queryForList(SqlName.ACTIVITIE_YLYXHB_GIFT_QUERY,actgift);
	}
	@Override
	public int addActivitiesWeChatGift(
			ActivitiesWeChatGiftDTO activitiesWeChatGiftDTO) throws Exception {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.addActivitiesWeChatGift, activitiesWeChatGiftDTO);
	}
	@Override
	public int updateActivitiesWeChatGift(
			ActivitiesWeChatGiftDTO activitiesWeChatGiftDTO) throws Exception {
		return this.sqlMapClientTemplate.update(SqlName.updateActivitesWeChatGift,activitiesWeChatGiftDTO);
	}
}
